<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String planId = request.getParameter("planId");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>为计划活动出谋划策页面</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<script type="text/javascript" src="<%=basePath%>JS/jquery-ui-1.11.2/external/jquery/jquery.js"></script>
	<script type="text/javascript" src="<%=basePath%>JS/jquery-ui-1.11.2/jquery-ui.js"></script>
	<script type="text/javascript" src="<%=basePath%>JS/jquery-validation-1.13.1/dist/jquery.validate.js"></script>
	<link rel="stylesheet" type="text/css" href="<%=basePath%>JS/jquery-ui-1.11.2/jquery-ui.css">
	<link rel="stylesheet" type="text/css" href="<%=basePath%>CSS/style.css">
	<link rel="stylesheet" type="text/css" href="<%=basePath%>JS/jquery-validation-1.13.1/demo/css/screen.css">
 

  </head>
  
  <body>
    	<div id="head-search">
   	 		<i class="home-path"></i>
   	 		<span class="path-font">活动管理&nbsp;&nbsp;>>&nbsp;&nbsp;计划活动&nbsp;&nbsp;>>&nbsp;&nbsp;活动详情</span>
   		</div>
  		<div class="mainbody" id="planAct">
  			<div id="planActDetail">
  			</div>
  			<div id="advisearea">
  				<div class="divrow">
  					<textarea rows="6" cols="80" id="advContent" name="advConent"></textarea>
  					<span class="span">
  						<button onclick="relAdvise()">发表意见</button>
					</span>
				</div>
  				<div id="adviselist"></div>
  			</div>
  		</div>  
  </body>
  <script>
  	 function relAdvise(){
  		 var advContent = $("#advContent").val();
  		 if(advContent==""){
  			 alert("请输入意见！！！");
  			 return;
  		 }
  		$.ajax({
    		  url:'<%=basePath%>relAdviseActoin',
    		  type:'post',
    		  timeout:1000,
    		  typeData:'json',
    		  data:{"planId":"<%=planId%>","advContent":advContent},
    		  beforeSend:beforeFun,
    		  error:errorFun,
    		  success:function(){
    			  getAdviseByPlanId();
				}	  
    	 	 });
  		 
  	 }
  
  	function getAdviseByPlanId(){
 		$.ajax({
   		  url:'<%=basePath%>getAdviseByPlanId',
   		  type:'get',
   		  timeout:1000,
   		  typeData:'json',
   		  data:{"planId":"<%=planId%>"},
   		  beforeSend:beforeFun,
   		  error:errorFun,
   		  success:function(datas){
   					$("#adviselist").html("");
   			  		var json = eval(datas);
   			  		$.each(json,function(index){
   			  			$("#adviselist").html($("#adviselist").html()+"<div class='commentlistclass'>"+
   			  					(index+1)+"、"+json[index].advContent+"</div>");
   			  		});
				}	  
   	 	 });
 		 
 	 }
  	 
  
  	 $(function(){
  		$.ajax({
  		  url:'<%=basePath%>getPlanActByID',
  		  type:'get',
  		  timeout:1000,
  		  typeData:'json',
  		  data:{"planId":"<%=planId%>"},
  		  beforeSend:beforeFun,
  		  error:errorFun,
  		  success:sucFun	  
  	 	 });
  		getAdviseByPlanId();
    });
    function beforeFun(){}
    function errorFun(){}
    //请求返回组织活动成功函数
   	function sucFun(datas){
  	 	 //alert(datas);
  		 var json = eval("("+datas+")");
  		//展示信息
  			$("#planActDetail").html("<div class='divrow'>活动主题："+json.planTheme+
  									"</div><div class='divrow'>地点："+json.planAddr+
  									"</div><div class='divrow'>时间："+json.planDate+"</div>");
    	}
  	
  
  </script>
</html>
